<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xppass Administrator's Control Panel</title>
<LINK href="<?php echo $www_site_url?>/public/yav-style.css" type=text/css rel=stylesheet>
<script src="<?php echo $www_site_url?>/public/js/common.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/calendar.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/ajax.js" type="text/javascript"></script>


<script>
function checkOnSubmit(formName) {
  	
	var url = "<?php echo $www_site_url?>/admin.php";
	var params = mini.form.serialize($(formName));
	mini.ajax.post(url, function(r){
		
		var r = eval('(' + r + ')');   
		if(r.s==200){
			window.location.href = r.d;
		}
		if(r.s==400){
			alert
			$('msg').innerHTML = r.m;			
		}
	}, params);
	
	return false;
       
}

</script>
</head>
<body><div id="append"></div>
<div id="msg" style="color:red;text-align:center"></div>


<script type="text/javascript">
	function setTab(n){
		document.getElementById("tabs_mainbox").style.display = 'block';
		document.getElementById("close").style.display = 'block';
		var tli=document.getElementById("tabs_menu").getElementsByTagName("li");
		var mli=document.getElementById("tabs_main").getElementsByTagName("div");
		for(i=0;i<tli.length;i++){
		  tli[i].className=i==n?"hover":"";
		  mli[i].style.display=i==n?"block":"none";
		}
	}
	function hid(){
		document.getElementById("tabs_mainbox").style.display = 'none';
		document.getElementById("close").style.display = 'none';
		var tli=document.getElementById("tabs_menu").getElementsByTagName("li");
		for(i=0;i<tli.length;i++){
		  tli[i].className="";
		}
	}

		
	</script>

	<div class="container">
		<div id="tabs">
			<div class="tabs_menubox">
				<ul id="tabs_menu">
					<li onclick="setTab(0)"><?php echo lang('search_domain')?></li>
					<li onclick="setTab(1)"><?php echo lang('add_domain')?></li>
					<li onclick="hid()" id="close" style="display:none;"><?php echo lang('hide')?>×</li>
				</ul>
			</div>
			<div id="tabs_mainbox" class="tabs_mainbox" style="display:none;">
				<div class="main" id="tabs_main" >
					<div  style="display:none;">
					<form id="adddomainform" name="adddomainform" action="<?php echo $www_site_url?>/admin.php" method="post" onsubmit="return checkOnSubmit('adddomainform');" >
					<input type="hidden" name="action" value="client">
					<input type="hidden" name="op" value="addclient">
					<table width="100%">
						<tr>
							<td align="right"><?php echo lang('new_domain')?>:</td>
							<td align="left"><input type="text" name="adddomain" class="textfield" /> <input type="submit" value="<?php echo lang('submit')?>" class="button"/></td>										
						</tr>
					</table>
					</form>

					</div>
				
			
					<div class="block" style="display:none;">
							<form action="<?php echo $www_site_url?>/admin.php" method="GET">
							<input type="hidden" name="action" value="client">
							<input type="hidden" name="view" value="defaults">				
							<table width="100%">
								<tr>
									<td align="right"><?php echo lang('domain')?>:</td>
									<td align="left"><input type="text" name="domain" value="<?php echo $con['domain']?>" class="textfield" /> <input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>						
								</tr>
							</table>
							</form>
					</div>

				</div>
			</div>
		</div>

		<br>
		<h3><?php echo lang('domain_list')?></h3>
		<div class="mainbox">
				<form action="<?php echo $www_site_url?>/admin.php" onsubmit="return confirm('<?php echo lang('domain_delete_comfirm')?>');" method="post">
				<input type="hidden" name="action" value="client">
				<input type="hidden" name="op" value="delclient">
				<table class="datalist fixwidth" onmouseover="addMouseEvent(this);" >

					<tr>
						<th><input type="checkbox" name="chkall" id="chkall" onclick="checkall('delete[]')" class="checkbox" /><label for="chkall"><?php echo lang('delete')?></label></th>
						<th>ID</th>
						<th><?php echo lang('domain')?></th>
						<th><?php echo lang('domain_password')?></th>

						
					</tr>
						<?php if(isset($clients['records']) && is_array($clients['records'])){
							foreach ($clients['records'] as $v){?>	
						<tr>
							<td class="option"><input type="checkbox" name="delete[]" value="<?php echo $v['client_id']?>" class="checkbox" /></td>
							<td><?php echo $v['client_id']?></td>
							<td><strong><?php echo $v['domain']?></strong></td>
							<td><?php echo $v['private_key']?></td>
						</tr>
					
						
						<?php }
						}?>
						<tr class="nobg">
						<td><input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>
						<td class="tdpage" colspan="7" align="right"><div class="pages"><?php echo $clients['pagebar']?></div></td>
					</tr>
				</table>

				</form>
					</div>
					
	</div>

</body>
</html>